package com.scujj.cs6.model.vo;

import com.scujj.cs6.model.entity.Comment;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.Date;

@Data
@Schema(name = "评论对象", description = "评论对象")
@AllArgsConstructor
@NoArgsConstructor
public class CommentVo {
    @Schema(name = "评论ID", description = "评论ID")
    private Long id;
    @Schema(name = "父评论ID", description = "父评论ID，为-1时表示是一级评论")
    private Long parentId;
    @Schema(name = "被回复用户ID", description = "被回复用户ID")
    private Long replyUserId;
    @Schema(name = "被回复用户名", description = "被回复用户名")
    private String replyUsername;
    @Schema(name = "被回复用户头像", description = "被回复用户头像")
    private String replyUserAvatar;
    @Schema(name = "用户ID", description = "用户ID")
    private Long userId;
    @Schema(name = "回答ID", description = "回答ID")
    private Long answerId;
    @Schema(name = "问题ID", description = "问题ID")
    private Long questionId;
    @Schema(name = "用户名", description = "用户名")
    private String username;
    @Schema(name = "用户头像", description = "用户头像")
    private String avatar;
    @Schema(name = "评论内容", description = "评论内容")
    private String content;
    @Schema(name = "创建时间", description = "创建时间")
    private Date createTime;
    @Schema(name = "更新时间", description = "更新时间")
    private Date updateTime;

    public CommentVo(Comment comment) {
        BeanUtils.copyProperties(comment, this);
    }
}
